<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="power by" content="http://www.whynto.com" />
	<title>欢迎您登陆系统管理平台</title>
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="power by" content="http://www.whynto.com" />
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<script type="text/javascript" src="js/jquery-1.11.2.min.js" ></script>
</head>
<body>
<div class="containt_all">
	<div class="login_header">
		<img src="images/logo_qy.png">
	</div>
	<div class="login_container">
		<div class="login_w1024">
			<form id="register_form" role="form" method="POST" action="{{url('/qiye_register')}}">
				{{ csrf_field() }}
				<ul class="ul_h3">
					<li class="login_user_tit mg_b3">企业注册<a href="{{url('/qiye')}}" class="register">返回登录>></a></li>
					<span id="error" style="margin-left: 18px;
"></span>
					<li class="login_user"><input type="text" class="input_text" placeholder="请输入用户名" id="email" name="email" required></li>
					<li class="login_pwd"><input type="password" autocomplete="off" class="input_text" placeholder="请输入密码" id="password" name="password" required></li>
					<li class="login_qy"><input type="text" class="input_text" placeholder="请输入企业名称" id="unit_name" name="unit_name" required></li>
					<li class="login_user"><input type="text" class="input_text" placeholder="请输入联系人" id="name" name="name" required></li>
					<li class="login_zz"><input type="text" class="input_text" placeholder="请输入组织机构代码证" id="org_code" name="org_code" required></li>
					<li class="login_btn">
						<input type="button" class="a" value="立即注册" onclick="return check();">
					</li>
				</ul>
			</form>
			<p class="login_promt">温馨提示：系统最佳浏览器为360急速浏览器和谷歌浏览器，最佳分辨率为1920×1080，最低浏览分辨率：1366*768。</p>
		</div>
	</div>
	<div class="login_footer">
		Copyright ©2017  All Rights Reserved 内保单位综合信息平台
	</div>
</div>
<script>
	$(function(){
		var h=$(window).height();
		var hc=$('.containt_all').height();
		$('.containt_all').css('margin-top',(h-hc)*0.3+'px');
	})
	//验证重名
	$('#email').blur(function(){
		var email = $('#email').val();
		check_name(email);
	});

	function check_name(email) {
		if(email){
			$.ajax({
				type:"post",
				url:"{{url('/check_name')}}",
				data:{'email':email,'_token':'{{csrf_token()}}'},
				dataType:"json",
				success:function(data){
					if(data.status==0){
						$('#error').html("<a style='color:red'>"+data.msg+"</a>");
						return false;
					}else{
						$('#error').html("<a style='color:green'>"+data.msg+"</a>");
					}
				}
			});
		}
	}

	function check() {
		//用户名
		var email = $('#email').val();
		var password = $('#password').val();
		var unit_name = $('#unit_name').val();
		var name = $('#name').val();
		var org_code = $('#org_code').val();
		if (email == "") {
			$('#error').html("<a style='color:red'>用户名不能为空</a>");
			return false;
		}
		if (password == "") {
			$('#error').html("<a style='color:red'>密码不能为空</a>");
			return false;
		}
		if (password.length < 6) {
			$('#error').html("<a style='color:red'>密码不能少于6位</a>");
			return false;
		}
		if (unit_name == "") {
			$('#error').html("<a style='color:red'>企业名称不能为空</a>");
			return false;
		}
		if (name == "") {
			$('#error').html("<a style='color:red'>联系人不能为空</a>");
			return false;
		}
		if (org_code == "") {
			$('#error').html("<a style='color:red'>组织机构代码证不能为空</a>");
			return false;
		}


		$('#register_form').submit();
	}
</script>
</body>
</html>